import localStore from "@/js/LocalStore.js";
const checkAccess = function (accessId) {
	let list = localStore.getLimits();
	if (list && list.length > 0) {
		for (let i = 0; i < list.length; i++) {
			if (list[i] == accessId) {
				return true;
			}
		}
	}
	return false;
}

// AccessCtrlRoute 路由数据对应 接口 staff_menu2_info 返回数据格式
/**
 * @property {number} fid - 菜单ID
 * @property {number} accessId - 权限ID
 * @property {string} title - 菜单标题
 * @property {boolean} access - 是否有访问权限
 * @property {string} path - 路由路径
 * @property {string} icon - 菜单图标
 * @property {boolean} isSetting - 是否为跳转设置菜单
 */
export const AccessCtrlRoute = [
	// 店铺管理
	{
		fid: 1,
		accessId: 27,
		title: "企业管理",
		access: true,
		path: "myCompany",
		icon: "el-icon-office-building",
		isSetting: true,
	},
	{
		fid: 1,
		accessId: 29,
		title: "门店管理",
		access: true,
		path: "storeManage",
		icon: "el-icon-s-home",
		isSetting: true,
	},
	{
		fid: 1,
		accessId: 43,
		title: "仓库管理",
		access: true,
		path: "warehouseManage",
		icon: "el-icon-receiving",
		isSetting: true,
	},
	{
		fid: 1,
		accessId: 30,
		title: "成员管理",
		access: true,
		path: "memberManage",
		icon: "el-icon-user-solid",
		isSetting: true,
	},
	{
		fid: 1,
		accessId: 28,
		title: "云店管理",
		access: true,
		path: "/pages/cloudStoreList/index",
		icon: "el-icon-s-shop",
		isSetting: false,
	},

	// 供应商管理
	{
		fid: 2,
		accessId: 105,
		title: "供应商管理",
		access: checkAccess(105),
		path: "/pages/supplier/index",
		icon: "el-icon-s-custom"
	},
	{
		fid: 2,
		accessId: 101,
		title: "供应商设置",
		access: checkAccess(101),
		path: "supplierSetting",
		isSetting: true,
		icon: "el-icon-setting"
	},
	{
		fid: 2,
		accessId: 42,
		title: "采购设置",
		access: checkAccess(42),
		path: "procureSetting",
		isSetting: true,
		icon: "el-icon-s-order"
	},
	{
		fid: 2,
		accessId: 999999,
		title: "供应商类别",
		access: false,
		path: "",
		txt: "请在供应商设置中操作",
		icon: "el-icon-s-custom"
	},

	// 客户管理
	{
		fid: 3,
		accessId: 103,
		title: "客户管理",
		access: checkAccess(103),
		path: "/pages/customer/index_v2",
		icon: "el-icon-user-solid"
	},
	{
		fid: 3,
		accessId: 100,
		title: "客户设置",
		access: checkAccess(100),
		path: "customerSetting",
		isSetting: true,
		icon: "el-icon-setting"
	},
	{
		fid: 3,
		accessId: 36,
		title: "销售设置",
		access: checkAccess(36),
		path: "salesSetting",
		isSetting: true,
		icon: "el-icon-s-shop"
	},
	{
		fid: 3,
		accessId: 50,
		title: "预约设置",
		access: checkAccess(50),
		path: "yuyueSetting",
		isSetting: true,
		icon: "el-icon-date"
	},
	{
		fid: 3,
		accessId: 103,
		title: "客户类别",
		access: checkAccess(103),
		path: "/pages/customer/index_v2",
		icon: "el-icon-s-grid"
	},
	{
		fid: 3,
		accessId: 103,
		title: "客户标签",
		access: checkAccess(103),
		path: "/pages/customer/index_v2",
		icon: "el-icon-price-tag"
	},
	{
		fid: 3,
		accessId: 115,
		title: "客户等级",
		access: checkAccess(115),
		path: "/pages/customer/index_v2",
		icon: "el-icon-s-ticket"
	},
	{
		fid: 3,
		accessId: 125,
		title: "客户积分",
		access: checkAccess(125),
		path: "/pages/customer/index_v2",
		icon: "el-icon-medal"
	},
	{
		fid: 3,
		accessId: 103,
		title: "跟进记录",
		access: checkAccess(103),
		path: "/pages/customer/index_v2",
		icon: "el-icon-edit-outline"
	},
	{
		fid: 3,
		accessId: 112,
		title: "分销记录",
		access: checkAccess(112),
		path: "/pages/customer/index_v2",
		icon: "el-icon-s-operation"
	},

	// 商品设置
	{
		fid: 4,
		accessId: 4,
		title: "商品管理",
		access: checkAccess(4),
		path: "/pages/goods/index",
		icon: "el-icon-s-goods"
	},
	{
		fid: 4,
		accessId: 35,
		title: "添加类别",
		access: checkAccess(35),
		path: "/pages/commodityConfig/index",
		icon: "el-icon-s-grid"
	},
	{
		fid: 4,
		accessId: 35,
		title: "添加品牌",
		access: checkAccess(35),
		path: "/pages/commodityConfig/index",
		icon: "el-icon-s-cooperation"
	},
	{
		fid: 4,
		accessId: 33,
		title: "添加标签",
		access: checkAccess(33),
		path: "/pages/commodityConfig/index",
		icon: "el-icon-price-tag"
	},
	{
		fid: 4,
		accessId: 35,
		title: "配置模版",
		access: checkAccess(35),
		path: "/pages/commodityConfig/index",
		icon: "el-icon-document"
	},
	{
		fid: 4,
		accessId: 35,
		title: "配置规格",
		access: checkAccess(35),
		path: "/pages/commodityConfig/index",
		icon: "el-icon-s-order"
	},
	{
		fid: 4,
		accessId: 35,
		title: "配置单位",
		access: checkAccess(35),
		path: "/pages/commodityConfig/index",
		icon: "el-icon-menu"
	},
	{
		fid: 4,
		accessId: 35,
		title: "配置多价格",
		access: checkAccess(35),
		path: "/pages/commodityConfig/index",
		icon: "el-icon-s-finance"
	},

	// 项目管理
	{
		fid: 5,
		accessId: 103,
		title: "项目管理",
		access: checkAccess(103),
		path: "/pages/project/index",
		icon: "el-icon-suitcase"
	},
	{
		fid: 5,
		accessId: 50,
		title: "添加类别",
		access: checkAccess(50),
		path: "/pages/projectConfig/index",
		icon: "el-icon-s-grid"
	},
	{
		fid: 5,
		accessId: 50,
		title: "添加品牌",
		access: checkAccess(50),
		path: "/pages/projectConfig/index",
		icon: "el-icon-s-cooperation"
	},
	{
		fid: 5,
		accessId: 65,
		title: "添加标签",
		access: checkAccess(65),
		path: "/pages/projectConfig/index",
		icon: "el-icon-price-tag"
	},
	{
		fid: 5,
		accessId: 50,
		title: "配置模版",
		access: checkAccess(50),
		path: "/pages/projectConfig/index",
		icon: "el-icon-document"
	},
	{
		fid: 5,
		accessId: 50,
		title: "配置有效期",
		access: checkAccess(50),
		path: "/pages/projectConfig/index",
		icon: "el-icon-date"
	},
	{
		fid: 5,
		accessId: 50,
		title: "配置单位",
		access: checkAccess(50),
		path: "/pages/projectConfig/index",
		icon: "el-icon-menu"
	},
	{
		fid: 5,
		accessId: 50,
		title: "配置多价格",
		access: checkAccess(50),
		path: "/pages/projectConfig/index",
		icon: "el-icon-s-finance"
	},

	// 营销模块（拉新留存）
	{
		fid: 6,
		accessId: 110,
		title: "短信营销",
		access: false, // 暂未开通,
		txt: "暂未开通",
		path: "/pages/smsMarket/index",
		icon: "el-icon-message-solid"
	},
	{
		fid: 6,
		accessId: 117,
		title: "会员签到",
		access: checkAccess(117),
		path: "/pages/signIn/index",
		icon: "el-icon-date"
	},
	{
		fid: 6,
		accessId: 116,
		title: "限时秒杀",
		access: checkAccess(116),
		path: "/pages/timeLimitseckill/index",
		icon: "el-icon-time"
	},
	{
		fid: 6,
		accessId: 109,
		title: "拼团优惠",
		access: checkAccess(109),
		path: "/pages/timeLimitsecGroup/index",
		icon: "el-icon-s-home"
	},
	{
		fid: 6,
		accessId: 84,
		title: "限时优惠",
		access: checkAccess(84),
		path: "/pages/timeLimitsecOffer/index",
		icon: "el-icon-s-ticket"
	},
	{
		fid: 6,
		accessId: 112,
		title: "分销有礼",
		access: checkAccess(112),
		path: "/pages/distrGifts/index",
		icon: "el-icon-s-cooperation"
	},
	{
		fid: 6,
		accessId: 134,
		title: "充值有礼",
		access: checkAccess(134),
		path: "/pages/rechargeGifts/index",
		icon: "el-icon-wallet"
	},
	{
		fid: 6,
		accessId: 115,
		title: "成长体系",
		access: checkAccess(115),
		path: "/pages/memberLevel/index",
		icon: "el-icon-s-ticket"
	},
	{
		fid: 6,
		accessId: 111,
		title: "积分体系",
		access: checkAccess(111),
		path: "/pages/pointsGifts/index",
		icon: "el-icon-present"
	}
]